package com.bzsg.rightsManagementSystem.service.impl

import com.bzsg.rightsManagementSystem.dao.RequestPathDao
import com.bzsg.rightsManagementSystem.pojo.RequestPath
import com.bzsg.rightsManagementSystem.service.RequestPathService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
class RequestPathServiceImpl : RequestPathService {
    @Autowired
    private lateinit var  requestPathDao: RequestPathDao
    override fun queryById(id: Int): RequestPath? {
        return requestPathDao.queryById(id)
    }

    override fun queryAllByLimit(offset: Int, limit: Int): List<RequestPath>? {
        val start = (offset - 1) * limit
        return requestPathDao.queryAllByLimit(start, limit)
    }

    override fun queryAll(): List<RequestPath>? {
        return requestPathDao.queryAll()
    }

    override fun insert(requestPath: RequestPath) {
        requestPathDao.insert(requestPath)
    }

    override fun update(requestPath: RequestPath) {
        requestPathDao.update(requestPath)
    }

    override fun deleteById(id: Int) {
        requestPathDao.deleteById(id)
    }

    override fun selectPathByPermissionId(permissionId: Int): List<RequestPath>? {
        return requestPathDao.selectPathByPermissionId(permissionId)
    }

    override fun selectTotalRequestPath(): Int {
        return requestPathDao.selectTotalRequestPath()
    }
}